//
//  LBTagsView.h
//  app
//
//  Created by 刘文扬 on 16/11/30.
//  Copyright © 2016年 广东联结电子商务有限公司. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "LBTagsModelProtocol.h"

@class LBTagsView;

@protocol LBTagsViewDelegate <NSObject>

@optional
-(void)tagsView:(LBTagsView *)tagsView didSelectTagIndex:(NSInteger)index data:(id)data;

@end

@interface LBTagsView : UIView


-(instancetype)initWithLimitedWidth:(CGFloat)limitedWidth textFont:(UIFont *)textFont textColor:(UIColor *)textColor leftAndRightMargin:(CGFloat)leftAndRightMargin itemMargin:(CGFloat)itemMargin rowMargin:(CGFloat)rowMargin data:(NSArray *)data backgroundImage:(UIImage *)backgroundImage imageEdgeInsets:(UIEdgeInsets)imageEdgeInsets;

/** 内容距离两端的空隙 默认5*/
@property(nonatomic,assign)CGFloat leftAndRightMargin;

/** 标签和标签之间的空隙 默认10*/
@property(nonatomic,assign)CGFloat itemMargin;

/** 标签背景颜色*/
@property(nonatomic,strong)UIColor *itemBackgroundColor;

/** 行和行之间的空隙 默认10*/
@property(nonatomic,assign)CGFloat rowMargin;

//默认是0,如果设置这个值不为0,那么就不会根据字体大小计算每个cell的高度.
@property(nonatomic,assign)CGFloat itemHeight;

/** 背景被拉伸需要设置的参数*/
@property(nonatomic,assign)UIEdgeInsets imageEdgeInsets;

/** 背景图,默认是空的*/
@property(nonatomic,strong)UIImage *lb_backgroundImage;

/** 背景图,选择背景图*/
@property(nonatomic,strong)UIImage *lb_selectedBackgroundImage;



/** 字体大小 默认12*/
@property(nonatomic,strong)UIFont *textFont;

/** 字体颜色 默认黑色*/
@property(nonatomic,strong)UIColor *textColor;

/** 字体颜色 默认黑色*/
@property(nonatomic,strong)UIColor *selectTextColor;

/** 是否有标签的间隔线 默认没有*/
@property(nonatomic,assign)BOOL haveGapLine;

/** 限定宽度,如果不限定,就只有一行*/
@property(nonatomic,assign)CGFloat limitedWidth;

/** 数据源*/
@property(nonatomic,strong)NSMutableArray<id<LBTagsModelProtocol>> *dataSource;

/** delegate*/
@property(nonatomic,weak)id<LBTagsViewDelegate> delegate;

/** collectionView*/
@property(nonatomic,strong)UICollectionView *tagsCollectionView;

-(void)reloadData;




//+(CGFloat)heightForViewWithLimitedWidth:(CGFloat)limitedWidth textFont:(UIFont *)textFont leftAndRightMargin:(CGFloat)leftAndRightMargin itemMargin:(CGFloat)itemMargin rowMargin:(CGFloat)rowMargin data:(NSArray *)data;

@end



